import "react-native-gesture-handler";
import React,{useEffect,useState} from "react";
import { SafeAreaView, StatusBar, StyleSheet,Image, View,Alert,Platform,Modal,Text,TouchableOpacity,Linking } from "react-native";
import * as S from "./src/screens/Home/styles.ts";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { ThemeProvider } from "styled-components/native";
import { AppRoutes } from "./src/routes/app.routes";
// import mainTheme from "./src/styles/themes/main";
import lightTheme from "./src/styles/themes/light";
import { TasksProvider } from "./src/hooks/useTasks";
import { CategoryProvider } from "./src/hooks/useCategory";
import { GlobalProvider,useGlobal} from "./src/utils/GlobalContext";

import Toast from "react-native-toast-message";
import { CalculateProvider } from "./src/hooks/useCalculate";
import { StatisticsProvider } from "./src/hooks/useStatistics";
import { StatisticsEventsProvider } from "./src/hooks/useStatisticsEvents";
import { toastConfig } from "./src/utils/config";

import AsyncStorage from "@react-native-async-storage/async-storage";

import { getVersion } from "jest";






export default function App() {
  

  

  
  useEffect(() => {

    // AsyncStorage.removeItem('guideStatistics')
    // AsyncStorage.removeItem('guideProfile')
    // AsyncStorage.removeItem('guideHome')
    // AsyncStorage.removeItem('guideCalculate')
    // AsyncStorage.removeItem('guideBudget')

    // AsyncStorage.setItem('guideStatistics','1')
    // AsyncStorage.setItem('guideProfile','1')
    // AsyncStorage.setItem('guideHome','1')
    // AsyncStorage.setItem('guideCalculate','1')
    // AsyncStorage.setItem('guideBudget','1')



    // 设置状态栏文字颜色（仅适用于 Android）
    StatusBar.setBarStyle('dark-content'); // 或 'light-content'
    StatusBar.setBackgroundColor('#fff');
    
  }, []);



  return (
    <>
      {/* <SafeAreaView style={{ flex: 0, backgroundColor: "white" }} /> */}
      {/* <SafeAreaView style={{ flex: 1 }}> */}
      <ThemeProvider theme={lightTheme}>
        <GlobalProvider>
          <GestureHandlerRootView style={{ flex: 1 }}>
            <TasksProvider>
              <CategoryProvider>
                <CalculateProvider>
                  <StatisticsProvider>
                    <StatisticsEventsProvider>
                      <AppRoutes />
                    </StatisticsEventsProvider>
                  </StatisticsProvider>
                </CalculateProvider>
              </CategoryProvider>
            </TasksProvider>
            {/* <StatusBar translucent={false} backgroundColor="white" /> */}
          </GestureHandlerRootView>
          <Toast config={toastConfig} />
        </GlobalProvider>
      </ThemeProvider>
      {/* </SafeAreaView> */}
      {/* <SafeAreaView style={{ flex: 0, backgroundColor: "white" }} /> */}
    </>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: "center",
    justifyContent: "center",
  },
});
